package com.xmy.cultivate.controller;

import com.xmy.cultivate.entity.BackData;
import com.xmy.cultivate.entity.OrderApply;
import com.xmy.cultivate.service.IBackDataService;
import com.xmy.cultivate.util.Code;
import com.xmy.cultivate.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;

/**
 * <p>
 * 需要回滚的sql 前端控制器
 * </p>
 *
 * @author min
 * @since 2022-11-28
 */
@RestController
@RequestMapping("/api/backData")
@Scope("prototype")
public class BackDataController {

    @Autowired
    IBackDataService iBackDataService;

    @PostMapping()
    public Result save(){
        String sqlInsert = "insert back_data (id,type,tb_name) VALUES(33,23,'3333')";
        iBackDataService.insertSql(sqlInsert);

        String sqlUpdate = "update back_data set tb_name = 'name' where id =1";

        iBackDataService.updateSql(sqlUpdate);

        String sqlDel = "delete from back_data where id = 1";

        iBackDataService.deleteSql(sqlDel);

        String sqlSelect = "select * from back_data";

        //Object backData = iBackDataService.selectSql(sqlSelect);



        return new Result(Code.OK);
    }

}
